//
//  tagQiniuVideoModule.m
//  tagQiniuVideoModule
//
//  Created by liqian on 2018/10/18.
//  Copyright © 2018年 liqian. All rights reserved.
//

#import "tagQiniuVideoModule.h"
#import "TagVideoViewController.h"
@implementation tagQiniuVideoModule
RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(RNOpenVC:(NSString *)msg){
    
    NSLog(@"RN传入原生界面的数据为:%@",msg);
    //主要这里必须使用主线程发送,不然有可能失效
    dispatch_async(dispatch_get_main_queue(), ^{
        
    });
}

/**
 *带参数回调RN
 *
 **/
RCT_EXPORT_METHOD(RNOpenVCAndCallback:(RCTResponseSenderBlock)callback){
    dispatch_async(dispatch_get_main_queue(), ^{
        TagVideoViewController *one = [[TagVideoViewController alloc]init];
        
        
        UINavigationController * navc = [[UINavigationController alloc] initWithRootViewController:one];
        UINavigationController * nav = [UIApplication sharedApplication].keyWindow.rootViewController;
        navc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
        navc.definesPresentationContext = YES;
        navc.providesPresentationContextTransitionStyle = YES;
        [nav presentViewController:navc animated:YES completion:nil];
//        one.path = ^(NSString *path) {
//            if (path == nil) {
//                callback(@[@"当前没有视频信息"]);
//            }
//            else{
//                callback(@[path]);
//            }
//        };
        
    });
    
}
@end
